import 'package:flutter/material.dart';

import 'package:speed_random/pages/home/rand_com/view_body_color.dart';
import 'package:speed_random/pages/home/rand_com/view_body_com.dart';
import 'package:speed_random/pages/home/rand_com/view_body_password.dart';
import 'package:speed_random/pages/home/rand_com/view_body_roller.dart';
import 'package:speed_random/pages/home/rand_com/view_body_rps.dart';
import 'package:speed_random/pages/home/rand_com/view_body_spin_wheel.dart';

import 'package:speed_random/pages/home/rand_com/view_body_toss2.dart';



import 'logic.dart';
import 'state.dart';


class ViewBody extends StatelessWidget {

  final RandComLogic logic;
  final RandComState state;

  const ViewBody({Key? key, required this.logic, required this.state}) : super(key: key);


  @override
  Widget build(BuildContext context) {
    var cachekey=logic.cachekey;
    if(cachekey.indexOf("rand_com_spin_wheel")!=-1){
      cachekey="rand_com_spin_wheel";
    }

    // 根据cachekey显示不同内容
    switch(cachekey) {
      case "rand_com_roller":
        return ViewBodyRoller(logic: logic, state: state);
      case "rand_com_rps":
        return ViewBodyRps(logic: logic, state: state);
      case "rand_com_color":
        return ViewBodyColor(logic: logic, state: state);
      case "rand_com_toss":
        return ViewBodyToss2(logic: logic, state: state);
      case "rand_com_spin_wheel":
        return ViewBodySpinWheel(logic: logic, state: state);
      case "rand_com_password":
        return ViewBodyPassword(logic: logic, state: state);
      default:
        return ViewBodyCom(logic: logic, state: state);
    }
  }


}


